package main

import (
	"sort"
	"testing"
)

func main() {

	m := map[int]string{1: "a", 2: "b", 3: "c"}
	var t = testing.T{}
	t.Logf("first range:")
	for k, v := range m {
		t.Logf("m[%v]=%v", k, v)
	}
	t.Log("second range:")
	for k, v := range m {
		t.Logf("m[%v]=%v", k, v)
	}
	//实现有序遍历
	var s []int
	for k := range m {
		s = append(s, k)
	}
	sort.Ints(s)
	for _, v := range s {
		t.Log(m[v])
	}

}


